package com.wrial.offer;
/*
 * @Author  Wrial
 * @Date Created in 21:29 2020/3/31
 * @Description 用两个栈实现队列
 */

import java.util.LinkedList;

public class FaceTest_9 {
    LinkedList<Integer> stack1 = new LinkedList<>();
    LinkedList<Integer> stack2 = new LinkedList<>();




    public void appendTail(int value) {
        stack1.addFirst(value);
    }

    public int deleteHead() {
        if(stack2!=null) return stack2.removeFirst();
        if(stack1 == null ) return -1;
        while(!stack1.isEmpty()){
            stack2.addLast(stack1.removeLast());
        }
        return stack2.removeLast();
    }
}
